WiiKart Program

<-- Prev --------- Contents --------- Next -->

Finally, a chance to incorporate the WiiMote into your programming! WooHoo!

At the end of this project, you will be able to drive your robot using the WiiMote much like you would a car. If you have ever played MarioKart with the Wii, you may have an idea of where this is going. We would like the following controls:
  • Holding the One button on the Wiimote tells the robot to start moving forward
  • Holding the Two Button on the Wiimote tells the robot to start moving in reverse
  • Tilting the Wiimote while holding the One or Two button will cause the robot to turn left or right as it moves forward or backward.

We will provide you will starter code, but the general outline of the code should be the following:
  • Declare your VexConnection variable (vc), and initialize the connection to the robot.
  • Declare your Wiimote variable (wii_mote), and initialize the connection to the wiimote.
  • In an infinite loop:
    • Get the state of the wiimote buttons.
    • If the One button is being pushed:
      • Get the normalized value of the Y Accelerometer from the wiimote.
      • Use it to determine how much to turn on each of the car's motors.
    • Else If the Two button is being pushed:
      • Get the normalized value of the Y Accelerometer from the wiimote.
      • Use it to determine how much to turn on each of the car's motors.
    • Else
      • Turn all of the motors off.

To simplify the process of programming this we are providing a shell for you to start using.


This is a Zip file. You will need to unzip it before using it.

To unzip you can open the folder and drag its contents to a new folder.

To open the project, double-click the "WiiKart Shell.sln" file. This file is a Microsoft Visual Studio Solution file -- basically the project wrapped up into one big file.

The WiimoteLib and the VexLib have already been added to the project for you.

Now you can start programming! We have indicated in the code the lines that you will have to edit or add to in order to get it all working. (Look for "EDIT THIS" in the code comments.) Also, if you get stumped, we've provided an extra section (after this one) to help you through it.

When you want to test your program, you will have to do some setup to get the bluetooth connections working, so take a look at the next two sections, "Bluetooth Communication" and "Pairing your Bluetooth Devices" before you run your program... otherwise it will give you an error.

<-- Prev --------- Contents --------- Next -->